package com.yy.web.pm.shopPeople.controller;

import com.yy.web.pm.billboard.domain.Dto.BillboardDto;
import com.yy.web.pm.billboard.service.BillboardDataService;
import com.yy.web.pm.shopPeople.Dto.ShopDto;
import com.yy.web.pm.shopPeople.domain.ShopPeople;
import com.yy.web.pm.shopPeople.mapper.ShopPeopleMapper;
import com.yy.web.pm.shopPeople.service.ShopPeopleService;
import com.yy.web.pm.until.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/shopPeople")
@Api(tags = "商家接口", description = "商家接口")
public class ShopPeopleController {
    @Autowired
    private ShopPeopleService shopPeopleService;
    @Autowired
    private ShopPeopleMapper shopPeopleMapper;

    @Qualifier("billboardDataServiceImpl")
    @Autowired
    private BillboardDataService billboardService;

    //查询商家列表 (包含商店，广告牌还有维修，还有rif过期时间)
    @ApiOperation(value = "查询商家列表")
    @GetMapping("/list")
    public Result billboardList(BillboardDto billboardDto) {
        System.out.println("当前走到了这个地方");
        return Result.success(billboardService.selectBillBoardList(billboardDto));
    }

    //整改，修改
    @ApiOperation(value = "商家店铺修改，或者整改")
    @PostMapping("/update")
    public Result update(@RequestBody ShopPeople shopPeople) {
        return Result.success(shopPeopleService.updateByPrimaryKeySelective(shopPeople));
    }

    // 新增店铺
    @ApiOperation(value = "新增店铺")
    public Result insert(@RequestBody ShopDto shopDto) {
        return Result.success(shopPeopleService.insertAnBillboard(shopDto));
    }

    //商家变更Rif
    @ApiOperation(value = "商家变更Rif")
    @PostMapping("/updateRif")
    public Result updateRif(@RequestBody BillboardDto billboardDto) {
        return Result.success(shopPeopleMapper.updateByPrimaryKeySelective(billboardDto));
    }

    //拆除列表商家接口
    @ApiOperation(value = "拆除列表商家接口")
    @GetMapping("/listRemove")
    public Result listRemove(ShopPeople billboardDto) {
        return Result.success(shopPeopleMapper.selectList(billboardDto));
    }

}

